<!doctype html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<link rel="icon" href="__PUBLIC__/Image/logo.ico">
    <link rel="stylesheet" href="__PUBLIC__/Css/Admin/login.css">
    
	<title>义达生态旅游管理平台登陆</title>
	
	<script type="text/javascript" src="__PUBLIC__/Js/lib/jquery-1.11.2.min.js"></script>
	<script type="text/javascript">
	$(function(){
		$("#sub_btn").click(function(){
			login();
		});
		
		onkeydown=function(event){
			if(event.which == 13){
				login();
			}
		};
	});
	
	/**
	 * 刷新验证码
	 */
	function refreshVerify(url){
		$("#verifyImg").attr("src", url);
	};
	
	/**
	 * 用户登录
	 */
	function login(){
		// ===== 数据合法性检查 =========
		// 账户信息(手机号)
		var username = $("#username").val();
		// 手机号的合法性检查
		if ($.trim(username) ==""){
			alert("请输入用户名！");
			return false;
		}
		
		// 密码
		var pwd = $("#password").val();
		// 密码的合法性检查
		if (pwd.length == 0){
			alert("密码不能为空！");
			return false;
		}
		// 用户名，密码后台check
		$.ajax({
			   url:"__URL__/checkLogin",
			   type:"POST",
				async: true,
			    data: "username=" + username + "&password=" + pwd,
			    dataType: "text",
			    success:function(respData) {
				   if(respData == "not found"){
					   alert("输入的用户不存在！");
					   return false;
				   } else if(respData == "error"){
					   alert("输入的密码不正确！");
					   return false;
				   } else if(respData == "success"){
					   $("#loginForm").submit();
				   }
			    },
			    error:function(){
			    	return false;
			    }
		   });
	}
	</script>
	
</head>
<body>
	<div id="login_center">
		<div id="login_area">
			<div id="login_form">
				<form action="{:U('Index/login')}" method="post" id="loginForm">
					<div id="login_tip">
						用户登录&nbsp;&nbsp;UserLogin
					</div>
					<div><input type="text" class="username" name="username" id="username"></div>
					<div><input type="password" class="pwd" name="password" id="password"></div>
					<div id="btn_area">
						<input type="button" id="sub_btn" value="登&nbsp;&nbsp;录">&nbsp;&nbsp;
					</div>
				</form>
			</div>
		</div>
	</div>
	<div id="login_bottom">
		<include file="Public:footer" />
	</div>
</body>
</html>